//
//  Date.swift
//  Automobile
//
//  Created by erkebulan elzhan on 7/27/20.
//  Copyright © 2020 erkebulan elzhan. All rights reserved.
//

import Foundation

@propertyWrapper
struct DateString {
    private(set) var value: String = ""
    
    var wrappedValue: String {
        get { value }
        set {
            let date = Date(timeIntervalSince1970: TimeInterval(Int(newValue)!))
            let dateFormatterGet = DateFormatter()
            dateFormatterGet.dateFormat = "dd.MM.yyyy"
            value = dateFormatterGet.string(from: date)
        }
    }
    init(initialValue: String) {
        self.wrappedValue = initialValue
    }
}

